{
 "nbformat": 4,
 "nbformat_minor": 0,
 "metadata": {
  "colab": {
   "provenance": [],
   "machine_shape": "hm",
   "gpuType": "T4",
   "authorship_tag": "ABX9TyM+MTqaLx5PrI6mNvkmSeb0"
  },
  "kernelspec": {
   "name": "python3",
   "display_name": "Python 3"
  },
  "language_info": {
   "name": "python"
  },
  "accelerator": "GPU"
 },
 "cells": [
  {
   "cell_type": "markdown",
   "source": [
    "![JohnSnowLabs](https://nlp.johnsnowlabs.com/assets/images/logo.png)\n",
    "\n",
    "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/JohnSnowLabs/nlu/blob/master/examples/colab/component_examples/entity_resolution/NLU_hpo_resolver_pipeline.ipynb)\n",
    "\n",
    "# Pipeline for Human Phenotype Ontology (HPO) Sentence Entity Resolver\n",
    "\n",
    "This advanced pipeline extracts human phenotype entities from clinical texts and utilizes the sbiobert_base_cased_mli Sentence Bert Embeddings to map these entities to their corresponding Human Phenotype Ontology (HPO) codes. It also returns associated codes from the following vocabularies for each HPO code: - MeSH (Medical Subject Headings)- SNOMED- UMLS (Unified Medical Language System ) - ORPHA (international reference resource for information on rare diseases and orphan drugs) - OMIM (Online Mendelian Inheritance in Man)."
   ],
   "metadata": {
    "id": "sKxRq0324UUc"
   }
  },
  {
   "cell_type": "code",
   "source": [
    "! pip install johnsnowlabs"
   ],
   "metadata": {
    "id": "N9h1HRhH0vY4"
   },
   "execution_count": null,
   "outputs": []
  },
  {
   "cell_type": "code",
   "source": [
    "import json\n",
    "import os\n",
    "\n",
    "import sparknlp\n",
    "import sparknlp_jsl\n",
    "import nlu\n",
    "\n",
    "from sparknlp.base import *\n",
    "from sparknlp.annotator import *\n",
    "from sparknlp_jsl.annotator import *\n",
    "\n",
    "from pyspark.sql import SparkSession\n",
    "from pyspark.sql import functions as F\n",
    "from pyspark.ml import Pipeline,PipelineModel\n",
    "\n",
    "import pandas as pd\n",
    "pd.set_option('display.max_colwidth', 200)\n",
    "\n",
    "import warnings\n",
    "warnings.filterwarnings('ignore')\n",
    "\n",
    "params = {\"spark.driver.memory\":\"16G\",\n",
    "          \"spark.kryosializer.buffer.max\":\"2000M\",\n",
    "          \"spark.driver.maxResultSize\":\"2000M\"}\n",
    "\n",
    "print(\"Spark NLP Version :\", sparknlp.version())\n",
    "print(\"Spark NLP_JSL Version :\", sparknlp_jsl.version())\n",
    "\n",
    "spark = sparknlp_jsl.start(license_keys['SECRET'],params=params)\n",
    "\n",
    "spark"
   ],
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 257
    },
    "id": "Z7HSiePK1Oxt",
    "executionInfo": {
     "status": "ok",
     "timestamp": 1712213297624,
     "user_tz": 240,
     "elapsed": 9476,
     "user": {
      "displayName": "Samed Koçer",
      "userId": "16161902236051002702"
     }
    },
    "outputId": "cc3b1c55-09d5-45df-a145-aa5f2ea58db8"
   },
   "execution_count": 2,
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "Spark NLP Version : 5.3.1\n",
      "Spark NLP_JSL Version : 5.3.1\n"
     ]
    },
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "<pyspark.sql.session.SparkSession at 0x7c0ecb38d210>"
      ],
      "text/html": [
       "\n",
       "            <div>\n",
       "                <p><b>SparkSession - in-memory</b></p>\n",
       "                \n",
       "        <div>\n",
       "            <p><b>SparkContext</b></p>\n",
       "\n",
       "            <p><a href=\"http://afb280fdc4a7:4040\">Spark UI</a></p>\n",
       "\n",
       "            <dl>\n",
       "              <dt>Version</dt>\n",
       "                <dd><code>v3.1.2</code></dd>\n",
       "              <dt>Master</dt>\n",
       "                <dd><code>local[*]</code></dd>\n",
       "              <dt>AppName</dt>\n",
       "                <dd><code>Spark NLP Licensed</code></dd>\n",
       "            </dl>\n",
       "        </div>\n",
       "        \n",
       "            </div>\n",
       "        "
      ]
     },
     "metadata": {},
     "execution_count": 2
    }
   ]
  },
  {
   "cell_type": "code",
   "source": [
    "nlu.__file__"
   ],
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 36
    },
    "id": "82hgAMVl1bpX",
    "executionInfo": {
     "status": "ok",
     "timestamp": 1712213196376,
     "user_tz": 240,
     "elapsed": 239,
     "user": {
      "displayName": "Samed Koçer",
      "userId": "16161902236051002702"
     }
    },
    "outputId": "3b64730d-b5f2-457c-9a3a-1cd3ce101ac6"
   },
   "execution_count": 5,
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "'/usr/local/lib/python3.10/dist-packages/nlu/__init__.py'"
      ],
      "application/vnd.google.colaboratory.intrinsic+json": {
       "type": "string"
      }
     },
     "metadata": {},
     "execution_count": 5
    }
   ]
  },
  {
   "cell_type": "code",
   "source": [
    "pipe = nlu.load(\"en.map_entity.hpo_resolver_pipe\")"
   ],
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "R56AbMEP2_fu",
    "executionInfo": {
     "status": "ok",
     "timestamp": 1712213500152,
     "user_tz": 240,
     "elapsed": 163037,
     "user": {
      "displayName": "Samed Koçer",
      "userId": "16161902236051002702"
     }
    },
    "outputId": "0f948c10-9355-4f1c-e20c-216dcf49f2d1"
   },
   "execution_count": 3,
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "Warning::Spark Session already created, some configs may not take.\n",
      "Warning::Spark Session already created, some configs may not take.\n",
      "hpo_resolver_pipeline download started this may take some time.\n",
      "Approx size to download 2.1 GB\n",
      "[OK!]\n"
     ]
    }
   ]
  },
  {
   "cell_type": "code",
   "source": [
    "text = [\"\"\"She is followed by Dr. X in our office and has a history of severe tricuspid regurgitation. On 05/12/08, preserved left and right ventricular systolic function, aortic sclerosis with apparent mild aortic stenosis. She has previously had a Persantine Myoview nuclear rest-stress test scan completed at ABCD Medical Center in 07/06 that was negative. She has had significant mitral valve regurgitation in the past being moderate, but on the most recent echocardiogram on 05/12/08, that was not felt to be significant. She does have a history of significant hypertension in the past. She has had dizzy spells and denies clearly any true syncope. She has had bradycardia in the past from beta-blocker therapy.\"\"\"]"
   ],
   "metadata": {
    "id": "dQTqc3dN3iJG",
    "executionInfo": {
     "status": "ok",
     "timestamp": 1712213505822,
     "user_tz": 240,
     "elapsed": 700,
     "user": {
      "displayName": "Samed Koçer",
      "userId": "16161902236051002702"
     }
    }
   },
   "execution_count": 4,
   "outputs": []
  },
  {
   "cell_type": "code",
   "source": [
    "df = pipe.predict(text)"
   ],
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "w-Wz0px63nQX",
    "executionInfo": {
     "status": "ok",
     "timestamp": 1712213517463,
     "user_tz": 240,
     "elapsed": 10279,
     "user": {
      "displayName": "Samed Koçer",
      "userId": "16161902236051002702"
     }
    },
    "outputId": "f26d2901-ef7f-493b-8766-7627f6509523"
   },
   "execution_count": 5,
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "\u001B[91m🚨 Your Spark-Healthcare is outdated, installed==5.3.1 but latest version==5.3.0\n",
      "You can run \u001B[92m nlp.install() \u001B[39mto update Spark-Healthcare\n",
      "Warning::Spark Session already created, some configs may not take.\n"
     ]
    }
   ]
  },
  {
   "cell_type": "code",
   "source": [
    "df"
   ],
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 1000
    },
    "id": "_Qqw3CCY3omz",
    "executionInfo": {
     "status": "ok",
     "timestamp": 1712213522543,
     "user_tz": 240,
     "elapsed": 898,
     "user": {
      "displayName": "Samed Koçer",
      "userId": "16161902236051002702"
     }
    },
    "outputId": "553e17d1-8858-4cfa-cba7-e4a60bc0619b"
   },
   "execution_count": 6,
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "                                                                                                                                                                                                  document  \\\n",
       "0  She is followed by Dr. X in our office and has a history of severe tricuspid regurgitation. On 05/12/08, preserved left and right ventricular systolic function, aortic sclerosis with apparent mild...   \n",
       "0  She is followed by Dr. X in our office and has a history of severe tricuspid regurgitation. On 05/12/08, preserved left and right ventricular systolic function, aortic sclerosis with apparent mild...   \n",
       "0  She is followed by Dr. X in our office and has a history of severe tricuspid regurgitation. On 05/12/08, preserved left and right ventricular systolic function, aortic sclerosis with apparent mild...   \n",
       "0  She is followed by Dr. X in our office and has a history of severe tricuspid regurgitation. On 05/12/08, preserved left and right ventricular systolic function, aortic sclerosis with apparent mild...   \n",
       "0  She is followed by Dr. X in our office and has a history of severe tricuspid regurgitation. On 05/12/08, preserved left and right ventricular systolic function, aortic sclerosis with apparent mild...   \n",
       "\n",
       "           entities_ner_chunk entities_ner_chunk_class  \\\n",
       "0     tricuspid regurgitation                       HP   \n",
       "0             aortic stenosis                       HP   \n",
       "0  mitral valve regurgitation                       HP   \n",
       "0                hypertension                       HP   \n",
       "0                 bradycardia                       HP   \n",
       "\n",
       "  entities_ner_chunk_confidence entities_ner_chunk_origin_chunk  \\\n",
       "0                        0.9826                       ner_chunk   \n",
       "0                           NaN                             NaN   \n",
       "0                           NaN                             NaN   \n",
       "0                           NaN                             NaN   \n",
       "0                           NaN                             NaN   \n",
       "\n",
       "  entities_ner_chunk_origin_sentence resolution_resolution_code  \\\n",
       "0                                  0                 HP:0005180   \n",
       "0                                  1                 HP:0001650   \n",
       "0                                  3                 HP:0001653   \n",
       "0                                  4                 HP:0000822   \n",
       "0                                  5                 HP:0001662   \n",
       "\n",
       "  resolution_resolution_confidence resolution_resolution_distance  \\\n",
       "0                           0.9899                         0.0000   \n",
       "0                           0.9740                         0.0000   \n",
       "0                           0.9867                         0.0000   \n",
       "0                           0.9974                         0.0000   \n",
       "0                           0.9724                         0.0000   \n",
       "\n",
       "                                                                                                                                                                             resolution_resolution_k_codes  \\\n",
       "0  [[HP:0005180, HP:0010446, HP:0001704, HP:0001702, HP:0030732, HP:0031444, HP:0011662, HP:0031651, HP:0031441, HP:0031443, HP:0011575, HP:0001653, HP:0010316, HP:0001659, HP:0031440, HP:0001647, HP...   \n",
       "0  [[HP:0005180, HP:0010446, HP:0001704, HP:0001702, HP:0030732, HP:0031444, HP:0011662, HP:0031651, HP:0031441, HP:0031443, HP:0011575, HP:0001653, HP:0010316, HP:0001659, HP:0031440, HP:0001647, HP...   \n",
       "0  [[HP:0005180, HP:0010446, HP:0001704, HP:0001702, HP:0030732, HP:0031444, HP:0011662, HP:0031651, HP:0031441, HP:0031443, HP:0011575, HP:0001653, HP:0010316, HP:0001659, HP:0031440, HP:0001647, HP...   \n",
       "0  [[HP:0005180, HP:0010446, HP:0001704, HP:0001702, HP:0030732, HP:0031444, HP:0011662, HP:0031651, HP:0031441, HP:0031443, HP:0011575, HP:0001653, HP:0010316, HP:0001659, HP:0031440, HP:0001647, HP...   \n",
       "0  [[HP:0005180, HP:0010446, HP:0001704, HP:0001702, HP:0030732, HP:0031444, HP:0011662, HP:0031651, HP:0031441, HP:0031443, HP:0011575, HP:0001653, HP:0010316, HP:0001659, HP:0031440, HP:0001647, HP...   \n",
       "\n",
       "   ...  \\\n",
       "0  ...   \n",
       "0  ...   \n",
       "0  ...   \n",
       "0  ...   \n",
       "0  ...   \n",
       "\n",
       "                                                                                                                                                       resolution_resolution_meta_resolution_k_ORPHA_codes  \\\n",
       "0  [ORPHA:228410, ORPHA:391641, ORPHA:1101, ORPHA:1759, ORPHA:1724, None, ORPHA:391641, None, None, None, ORPHA:1880, ORPHA:363700, ORPHA:466791, ORPHA:2181, None, ORPHA:1772, ORPHA:2255, ORPHA:53647...   \n",
       "0  [ORPHA:228410, ORPHA:391641, ORPHA:1101, ORPHA:1759, ORPHA:1724, None, ORPHA:391641, None, None, None, ORPHA:1880, ORPHA:363700, ORPHA:466791, ORPHA:2181, None, ORPHA:1772, ORPHA:2255, ORPHA:53647...   \n",
       "0  [ORPHA:228410, ORPHA:391641, ORPHA:1101, ORPHA:1759, ORPHA:1724, None, ORPHA:391641, None, None, None, ORPHA:1880, ORPHA:363700, ORPHA:466791, ORPHA:2181, None, ORPHA:1772, ORPHA:2255, ORPHA:53647...   \n",
       "0  [ORPHA:228410, ORPHA:391641, ORPHA:1101, ORPHA:1759, ORPHA:1724, None, ORPHA:391641, None, None, None, ORPHA:1880, ORPHA:363700, ORPHA:466791, ORPHA:2181, None, ORPHA:1772, ORPHA:2255, ORPHA:53647...   \n",
       "0  [ORPHA:228410, ORPHA:391641, ORPHA:1101, ORPHA:1759, ORPHA:1724, None, ORPHA:391641, None, None, None, ORPHA:1880, ORPHA:363700, ORPHA:466791, ORPHA:2181, None, ORPHA:1772, ORPHA:2255, ORPHA:53647...   \n",
       "\n",
       "                                                                                                                                                      resolution_resolution_meta_resolution_k_SNOMED_codes  \\\n",
       "0  [SNOMED:111287006, SNOMED:49915006, SNOMED:253383003, None, None, None, SNOMED:253455004,63042009, None, None, None, None, SNOMED:48724000, SNOMED:204357006, SNOMED:60234000, None, SNOMED:72352009...   \n",
       "0  [SNOMED:111287006, SNOMED:49915006, SNOMED:253383003, None, None, None, SNOMED:253455004,63042009, None, None, None, None, SNOMED:48724000, SNOMED:204357006, SNOMED:60234000, None, SNOMED:72352009...   \n",
       "0  [SNOMED:111287006, SNOMED:49915006, SNOMED:253383003, None, None, None, SNOMED:253455004,63042009, None, None, None, None, SNOMED:48724000, SNOMED:204357006, SNOMED:60234000, None, SNOMED:72352009...   \n",
       "0  [SNOMED:111287006, SNOMED:49915006, SNOMED:253383003, None, None, None, SNOMED:253455004,63042009, None, None, None, None, SNOMED:48724000, SNOMED:204357006, SNOMED:60234000, None, SNOMED:72352009...   \n",
       "0  [SNOMED:111287006, SNOMED:49915006, SNOMED:253383003, None, None, None, SNOMED:253455004,63042009, None, None, None, None, SNOMED:48724000, SNOMED:204357006, SNOMED:60234000, None, SNOMED:72352009...   \n",
       "\n",
       "                                                                                                                                                        resolution_resolution_meta_resolution_k_UMLS_codes  \\\n",
       "0  [UMLS:C0040961, UMLS:C0040963, UMLS:C0040962, UMLS:C4025753, UMLS:C4255215, None, UMLS:C0243002, None, None, None, UMLS:C4023292, UMLS:C0026266,C3551535, UMLS:C0013481, UMLS:C0003504, None, UMLS:C...   \n",
       "0  [UMLS:C0040961, UMLS:C0040963, UMLS:C0040962, UMLS:C4025753, UMLS:C4255215, None, UMLS:C0243002, None, None, None, UMLS:C4023292, UMLS:C0026266,C3551535, UMLS:C0013481, UMLS:C0003504, None, UMLS:C...   \n",
       "0  [UMLS:C0040961, UMLS:C0040963, UMLS:C0040962, UMLS:C4025753, UMLS:C4255215, None, UMLS:C0243002, None, None, None, UMLS:C4023292, UMLS:C0026266,C3551535, UMLS:C0013481, UMLS:C0003504, None, UMLS:C...   \n",
       "0  [UMLS:C0040961, UMLS:C0040963, UMLS:C0040962, UMLS:C4025753, UMLS:C4255215, None, UMLS:C0243002, None, None, None, UMLS:C4023292, UMLS:C0026266,C3551535, UMLS:C0013481, UMLS:C0003504, None, UMLS:C...   \n",
       "0  [UMLS:C0040961, UMLS:C0040963, UMLS:C0040962, UMLS:C4025753, UMLS:C4255215, None, UMLS:C0243002, None, None, None, UMLS:C4023292, UMLS:C0026266,C3551535, UMLS:C0013481, UMLS:C0003504, None, UMLS:C...   \n",
       "\n",
       "  resolution_resolution_origin_sentence resolution_resolution_resolved_text  \\\n",
       "0                                     0             tricuspid regurgitation   \n",
       "0                                     1                     aortic stenosis   \n",
       "0                                     3          mitral valve regurgitation   \n",
       "0                                     4                        hypertension   \n",
       "0                                     5                         bradycardia   \n",
       "\n",
       "  resolution_resolution_target_text resolution_resolution_token  \\\n",
       "0           tricuspid regurgitation     tricuspid regurgitation   \n",
       "0                   aortic stenosis             aortic stenosis   \n",
       "0        mitral valve regurgitation  mitral valve regurgitation   \n",
       "0                      hypertension                hypertension   \n",
       "0                       bradycardia                 bradycardia   \n",
       "\n",
       "                                                                                                                                                                                               sentence_dl  \\\n",
       "0  [She is followed by Dr. X in our office and has a history of severe tricuspid regurgitation., On 05/12/08, preserved left and right ventricular systolic function, aortic sclerosis with apparent mi...   \n",
       "0  [She is followed by Dr. X in our office and has a history of severe tricuspid regurgitation., On 05/12/08, preserved left and right ventricular systolic function, aortic sclerosis with apparent mi...   \n",
       "0  [She is followed by Dr. X in our office and has a history of severe tricuspid regurgitation., On 05/12/08, preserved left and right ventricular systolic function, aortic sclerosis with apparent mi...   \n",
       "0  [She is followed by Dr. X in our office and has a history of severe tricuspid regurgitation., On 05/12/08, preserved left and right ventricular systolic function, aortic sclerosis with apparent mi...   \n",
       "0  [She is followed by Dr. X in our office and has a history of severe tricuspid regurgitation., On 05/12/08, preserved left and right ventricular systolic function, aortic sclerosis with apparent mi...   \n",
       "\n",
       "                                                                                                                                                                       sentence_embedding_sbert_embeddings  \\\n",
       "0  [[0.40901488065719604, -0.09854041039943695, -0.21287906169891357, 0.3738410472869873, 1.4597432613372803, -0.2503955364227295, -0.29258039593696594, 0.7664100527763367, 1.0721549987792969, 0.7082...   \n",
       "0  [[0.40901488065719604, -0.09854041039943695, -0.21287906169891357, 0.3738410472869873, 1.4597432613372803, -0.2503955364227295, -0.29258039593696594, 0.7664100527763367, 1.0721549987792969, 0.7082...   \n",
       "0  [[0.40901488065719604, -0.09854041039943695, -0.21287906169891357, 0.3738410472869873, 1.4597432613372803, -0.2503955364227295, -0.29258039593696594, 0.7664100527763367, 1.0721549987792969, 0.7082...   \n",
       "0  [[0.40901488065719604, -0.09854041039943695, -0.21287906169891357, 0.3738410472869873, 1.4597432613372803, -0.2503955364227295, -0.29258039593696594, 0.7664100527763367, 1.0721549987792969, 0.7082...   \n",
       "0  [[0.40901488065719604, -0.09854041039943695, -0.21287906169891357, 0.3738410472869873, 1.4597432613372803, -0.2503955364227295, -0.29258039593696594, 0.7664100527763367, 1.0721549987792969, 0.7082...   \n",
       "\n",
       "                                                                                                                                                                            word_embedding_word_embeddings  \n",
       "0  [[-0.21964989602565765, -0.2844458520412445, -0.10418396443128586, -0.5357521772384644, -0.06646879762411118, -0.444497287273407, -0.5000978708267212, -0.5944756269454956, 0.1369660645723343, 0.04...  \n",
       "0  [[-0.21964989602565765, -0.2844458520412445, -0.10418396443128586, -0.5357521772384644, -0.06646879762411118, -0.444497287273407, -0.5000978708267212, -0.5944756269454956, 0.1369660645723343, 0.04...  \n",
       "0  [[-0.21964989602565765, -0.2844458520412445, -0.10418396443128586, -0.5357521772384644, -0.06646879762411118, -0.444497287273407, -0.5000978708267212, -0.5944756269454956, 0.1369660645723343, 0.04...  \n",
       "0  [[-0.21964989602565765, -0.2844458520412445, -0.10418396443128586, -0.5357521772384644, -0.06646879762411118, -0.444497287273407, -0.5000978708267212, -0.5944756269454956, 0.1369660645723343, 0.04...  \n",
       "0  [[-0.21964989602565765, -0.2844458520412445, -0.10418396443128586, -0.5357521772384644, -0.06646879762411118, -0.444497287273407, -0.5000978708267212, -0.5944756269454956, 0.1369660645723343, 0.04...  \n",
       "\n",
       "[5 rows x 26 columns]"
      ],
      "text/html": [
       "\n",
       "  <div id=\"df-5650be7c-285e-430a-bb7e-c62ac1f769b6\" class=\"colab-df-container\">\n",
       "    <div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>document</th>\n",
       "      <th>entities_ner_chunk</th>\n",
       "      <th>entities_ner_chunk_class</th>\n",
       "      <th>entities_ner_chunk_confidence</th>\n",
       "      <th>entities_ner_chunk_origin_chunk</th>\n",
       "      <th>entities_ner_chunk_origin_sentence</th>\n",
       "      <th>resolution_resolution_code</th>\n",
       "      <th>resolution_resolution_confidence</th>\n",
       "      <th>resolution_resolution_distance</th>\n",
       "      <th>resolution_resolution_k_codes</th>\n",
       "      <th>...</th>\n",
       "      <th>resolution_resolution_meta_resolution_k_ORPHA_codes</th>\n",
       "      <th>resolution_resolution_meta_resolution_k_SNOMED_codes</th>\n",
       "      <th>resolution_resolution_meta_resolution_k_UMLS_codes</th>\n",
       "      <th>resolution_resolution_origin_sentence</th>\n",
       "      <th>resolution_resolution_resolved_text</th>\n",
       "      <th>resolution_resolution_target_text</th>\n",
       "      <th>resolution_resolution_token</th>\n",
       "      <th>sentence_dl</th>\n",
       "      <th>sentence_embedding_sbert_embeddings</th>\n",
       "      <th>word_embedding_word_embeddings</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>She is followed by Dr. X in our office and has a history of severe tricuspid regurgitation. On 05/12/08, preserved left and right ventricular systolic function, aortic sclerosis with apparent mild...</td>\n",
       "      <td>tricuspid regurgitation</td>\n",
       "      <td>HP</td>\n",
       "      <td>0.9826</td>\n",
       "      <td>ner_chunk</td>\n",
       "      <td>0</td>\n",
       "      <td>HP:0005180</td>\n",
       "      <td>0.9899</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>[[HP:0005180, HP:0010446, HP:0001704, HP:0001702, HP:0030732, HP:0031444, HP:0011662, HP:0031651, HP:0031441, HP:0031443, HP:0011575, HP:0001653, HP:0010316, HP:0001659, HP:0031440, HP:0001647, HP...</td>\n",
       "      <td>...</td>\n",
       "      <td>[ORPHA:228410, ORPHA:391641, ORPHA:1101, ORPHA:1759, ORPHA:1724, None, ORPHA:391641, None, None, None, ORPHA:1880, ORPHA:363700, ORPHA:466791, ORPHA:2181, None, ORPHA:1772, ORPHA:2255, ORPHA:53647...</td>\n",
       "      <td>[SNOMED:111287006, SNOMED:49915006, SNOMED:253383003, None, None, None, SNOMED:253455004,63042009, None, None, None, None, SNOMED:48724000, SNOMED:204357006, SNOMED:60234000, None, SNOMED:72352009...</td>\n",
       "      <td>[UMLS:C0040961, UMLS:C0040963, UMLS:C0040962, UMLS:C4025753, UMLS:C4255215, None, UMLS:C0243002, None, None, None, UMLS:C4023292, UMLS:C0026266,C3551535, UMLS:C0013481, UMLS:C0003504, None, UMLS:C...</td>\n",
       "      <td>0</td>\n",
       "      <td>tricuspid regurgitation</td>\n",
       "      <td>tricuspid regurgitation</td>\n",
       "      <td>tricuspid regurgitation</td>\n",
       "      <td>[She is followed by Dr. X in our office and has a history of severe tricuspid regurgitation., On 05/12/08, preserved left and right ventricular systolic function, aortic sclerosis with apparent mi...</td>\n",
       "      <td>[[0.40901488065719604, -0.09854041039943695, -0.21287906169891357, 0.3738410472869873, 1.4597432613372803, -0.2503955364227295, -0.29258039593696594, 0.7664100527763367, 1.0721549987792969, 0.7082...</td>\n",
       "      <td>[[-0.21964989602565765, -0.2844458520412445, -0.10418396443128586, -0.5357521772384644, -0.06646879762411118, -0.444497287273407, -0.5000978708267212, -0.5944756269454956, 0.1369660645723343, 0.04...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>She is followed by Dr. X in our office and has a history of severe tricuspid regurgitation. On 05/12/08, preserved left and right ventricular systolic function, aortic sclerosis with apparent mild...</td>\n",
       "      <td>aortic stenosis</td>\n",
       "      <td>HP</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>HP:0001650</td>\n",
       "      <td>0.9740</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>[[HP:0005180, HP:0010446, HP:0001704, HP:0001702, HP:0030732, HP:0031444, HP:0011662, HP:0031651, HP:0031441, HP:0031443, HP:0011575, HP:0001653, HP:0010316, HP:0001659, HP:0031440, HP:0001647, HP...</td>\n",
       "      <td>...</td>\n",
       "      <td>[ORPHA:228410, ORPHA:391641, ORPHA:1101, ORPHA:1759, ORPHA:1724, None, ORPHA:391641, None, None, None, ORPHA:1880, ORPHA:363700, ORPHA:466791, ORPHA:2181, None, ORPHA:1772, ORPHA:2255, ORPHA:53647...</td>\n",
       "      <td>[SNOMED:111287006, SNOMED:49915006, SNOMED:253383003, None, None, None, SNOMED:253455004,63042009, None, None, None, None, SNOMED:48724000, SNOMED:204357006, SNOMED:60234000, None, SNOMED:72352009...</td>\n",
       "      <td>[UMLS:C0040961, UMLS:C0040963, UMLS:C0040962, UMLS:C4025753, UMLS:C4255215, None, UMLS:C0243002, None, None, None, UMLS:C4023292, UMLS:C0026266,C3551535, UMLS:C0013481, UMLS:C0003504, None, UMLS:C...</td>\n",
       "      <td>1</td>\n",
       "      <td>aortic stenosis</td>\n",
       "      <td>aortic stenosis</td>\n",
       "      <td>aortic stenosis</td>\n",
       "      <td>[She is followed by Dr. X in our office and has a history of severe tricuspid regurgitation., On 05/12/08, preserved left and right ventricular systolic function, aortic sclerosis with apparent mi...</td>\n",
       "      <td>[[0.40901488065719604, -0.09854041039943695, -0.21287906169891357, 0.3738410472869873, 1.4597432613372803, -0.2503955364227295, -0.29258039593696594, 0.7664100527763367, 1.0721549987792969, 0.7082...</td>\n",
       "      <td>[[-0.21964989602565765, -0.2844458520412445, -0.10418396443128586, -0.5357521772384644, -0.06646879762411118, -0.444497287273407, -0.5000978708267212, -0.5944756269454956, 0.1369660645723343, 0.04...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>She is followed by Dr. X in our office and has a history of severe tricuspid regurgitation. On 05/12/08, preserved left and right ventricular systolic function, aortic sclerosis with apparent mild...</td>\n",
       "      <td>mitral valve regurgitation</td>\n",
       "      <td>HP</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3</td>\n",
       "      <td>HP:0001653</td>\n",
       "      <td>0.9867</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>[[HP:0005180, HP:0010446, HP:0001704, HP:0001702, HP:0030732, HP:0031444, HP:0011662, HP:0031651, HP:0031441, HP:0031443, HP:0011575, HP:0001653, HP:0010316, HP:0001659, HP:0031440, HP:0001647, HP...</td>\n",
       "      <td>...</td>\n",
       "      <td>[ORPHA:228410, ORPHA:391641, ORPHA:1101, ORPHA:1759, ORPHA:1724, None, ORPHA:391641, None, None, None, ORPHA:1880, ORPHA:363700, ORPHA:466791, ORPHA:2181, None, ORPHA:1772, ORPHA:2255, ORPHA:53647...</td>\n",
       "      <td>[SNOMED:111287006, SNOMED:49915006, SNOMED:253383003, None, None, None, SNOMED:253455004,63042009, None, None, None, None, SNOMED:48724000, SNOMED:204357006, SNOMED:60234000, None, SNOMED:72352009...</td>\n",
       "      <td>[UMLS:C0040961, UMLS:C0040963, UMLS:C0040962, UMLS:C4025753, UMLS:C4255215, None, UMLS:C0243002, None, None, None, UMLS:C4023292, UMLS:C0026266,C3551535, UMLS:C0013481, UMLS:C0003504, None, UMLS:C...</td>\n",
       "      <td>3</td>\n",
       "      <td>mitral valve regurgitation</td>\n",
       "      <td>mitral valve regurgitation</td>\n",
       "      <td>mitral valve regurgitation</td>\n",
       "      <td>[She is followed by Dr. X in our office and has a history of severe tricuspid regurgitation., On 05/12/08, preserved left and right ventricular systolic function, aortic sclerosis with apparent mi...</td>\n",
       "      <td>[[0.40901488065719604, -0.09854041039943695, -0.21287906169891357, 0.3738410472869873, 1.4597432613372803, -0.2503955364227295, -0.29258039593696594, 0.7664100527763367, 1.0721549987792969, 0.7082...</td>\n",
       "      <td>[[-0.21964989602565765, -0.2844458520412445, -0.10418396443128586, -0.5357521772384644, -0.06646879762411118, -0.444497287273407, -0.5000978708267212, -0.5944756269454956, 0.1369660645723343, 0.04...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>She is followed by Dr. X in our office and has a history of severe tricuspid regurgitation. On 05/12/08, preserved left and right ventricular systolic function, aortic sclerosis with apparent mild...</td>\n",
       "      <td>hypertension</td>\n",
       "      <td>HP</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>4</td>\n",
       "      <td>HP:0000822</td>\n",
       "      <td>0.9974</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>[[HP:0005180, HP:0010446, HP:0001704, HP:0001702, HP:0030732, HP:0031444, HP:0011662, HP:0031651, HP:0031441, HP:0031443, HP:0011575, HP:0001653, HP:0010316, HP:0001659, HP:0031440, HP:0001647, HP...</td>\n",
       "      <td>...</td>\n",
       "      <td>[ORPHA:228410, ORPHA:391641, ORPHA:1101, ORPHA:1759, ORPHA:1724, None, ORPHA:391641, None, None, None, ORPHA:1880, ORPHA:363700, ORPHA:466791, ORPHA:2181, None, ORPHA:1772, ORPHA:2255, ORPHA:53647...</td>\n",
       "      <td>[SNOMED:111287006, SNOMED:49915006, SNOMED:253383003, None, None, None, SNOMED:253455004,63042009, None, None, None, None, SNOMED:48724000, SNOMED:204357006, SNOMED:60234000, None, SNOMED:72352009...</td>\n",
       "      <td>[UMLS:C0040961, UMLS:C0040963, UMLS:C0040962, UMLS:C4025753, UMLS:C4255215, None, UMLS:C0243002, None, None, None, UMLS:C4023292, UMLS:C0026266,C3551535, UMLS:C0013481, UMLS:C0003504, None, UMLS:C...</td>\n",
       "      <td>4</td>\n",
       "      <td>hypertension</td>\n",
       "      <td>hypertension</td>\n",
       "      <td>hypertension</td>\n",
       "      <td>[She is followed by Dr. X in our office and has a history of severe tricuspid regurgitation., On 05/12/08, preserved left and right ventricular systolic function, aortic sclerosis with apparent mi...</td>\n",
       "      <td>[[0.40901488065719604, -0.09854041039943695, -0.21287906169891357, 0.3738410472869873, 1.4597432613372803, -0.2503955364227295, -0.29258039593696594, 0.7664100527763367, 1.0721549987792969, 0.7082...</td>\n",
       "      <td>[[-0.21964989602565765, -0.2844458520412445, -0.10418396443128586, -0.5357521772384644, -0.06646879762411118, -0.444497287273407, -0.5000978708267212, -0.5944756269454956, 0.1369660645723343, 0.04...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>She is followed by Dr. X in our office and has a history of severe tricuspid regurgitation. On 05/12/08, preserved left and right ventricular systolic function, aortic sclerosis with apparent mild...</td>\n",
       "      <td>bradycardia</td>\n",
       "      <td>HP</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5</td>\n",
       "      <td>HP:0001662</td>\n",
       "      <td>0.9724</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>[[HP:0005180, HP:0010446, HP:0001704, HP:0001702, HP:0030732, HP:0031444, HP:0011662, HP:0031651, HP:0031441, HP:0031443, HP:0011575, HP:0001653, HP:0010316, HP:0001659, HP:0031440, HP:0001647, HP...</td>\n",
       "      <td>...</td>\n",
       "      <td>[ORPHA:228410, ORPHA:391641, ORPHA:1101, ORPHA:1759, ORPHA:1724, None, ORPHA:391641, None, None, None, ORPHA:1880, ORPHA:363700, ORPHA:466791, ORPHA:2181, None, ORPHA:1772, ORPHA:2255, ORPHA:53647...</td>\n",
       "      <td>[SNOMED:111287006, SNOMED:49915006, SNOMED:253383003, None, None, None, SNOMED:253455004,63042009, None, None, None, None, SNOMED:48724000, SNOMED:204357006, SNOMED:60234000, None, SNOMED:72352009...</td>\n",
       "      <td>[UMLS:C0040961, UMLS:C0040963, UMLS:C0040962, UMLS:C4025753, UMLS:C4255215, None, UMLS:C0243002, None, None, None, UMLS:C4023292, UMLS:C0026266,C3551535, UMLS:C0013481, UMLS:C0003504, None, UMLS:C...</td>\n",
       "      <td>5</td>\n",
       "      <td>bradycardia</td>\n",
       "      <td>bradycardia</td>\n",
       "      <td>bradycardia</td>\n",
       "      <td>[She is followed by Dr. X in our office and has a history of severe tricuspid regurgitation., On 05/12/08, preserved left and right ventricular systolic function, aortic sclerosis with apparent mi...</td>\n",
       "      <td>[[0.40901488065719604, -0.09854041039943695, -0.21287906169891357, 0.3738410472869873, 1.4597432613372803, -0.2503955364227295, -0.29258039593696594, 0.7664100527763367, 1.0721549987792969, 0.7082...</td>\n",
       "      <td>[[-0.21964989602565765, -0.2844458520412445, -0.10418396443128586, -0.5357521772384644, -0.06646879762411118, -0.444497287273407, -0.5000978708267212, -0.5944756269454956, 0.1369660645723343, 0.04...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 26 columns</p>\n",
       "</div>\n",
       "    <div class=\"colab-df-buttons\">\n",
       "\n",
       "  <div class=\"colab-df-container\">\n",
       "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-5650be7c-285e-430a-bb7e-c62ac1f769b6')\"\n",
       "            title=\"Convert this dataframe to an interactive table.\"\n",
       "            style=\"display:none;\">\n",
       "\n",
       "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
       "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
       "  </svg>\n",
       "    </button>\n",
       "\n",
       "  <style>\n",
       "    .colab-df-container {\n",
       "      display:flex;\n",
       "      gap: 12px;\n",
       "    }\n",
       "\n",
       "    .colab-df-convert {\n",
       "      background-color: #E8F0FE;\n",
       "      border: none;\n",
       "      border-radius: 50%;\n",
       "      cursor: pointer;\n",
       "      display: none;\n",
       "      fill: #1967D2;\n",
       "      height: 32px;\n",
       "      padding: 0 0 0 0;\n",
       "      width: 32px;\n",
       "    }\n",
       "\n",
       "    .colab-df-convert:hover {\n",
       "      background-color: #E2EBFA;\n",
       "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
       "      fill: #174EA6;\n",
       "    }\n",
       "\n",
       "    .colab-df-buttons div {\n",
       "      margin-bottom: 4px;\n",
       "    }\n",
       "\n",
       "    [theme=dark] .colab-df-convert {\n",
       "      background-color: #3B4455;\n",
       "      fill: #D2E3FC;\n",
       "    }\n",
       "\n",
       "    [theme=dark] .colab-df-convert:hover {\n",
       "      background-color: #434B5C;\n",
       "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
       "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
       "      fill: #FFFFFF;\n",
       "    }\n",
       "  </style>\n",
       "\n",
       "    <script>\n",
       "      const buttonEl =\n",
       "        document.querySelector('#df-5650be7c-285e-430a-bb7e-c62ac1f769b6 button.colab-df-convert');\n",
       "      buttonEl.style.display =\n",
       "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
       "\n",
       "      async function convertToInteractive(key) {\n",
       "        const element = document.querySelector('#df-5650be7c-285e-430a-bb7e-c62ac1f769b6');\n",
       "        const dataTable =\n",
       "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
       "                                                    [key], {});\n",
       "        if (!dataTable) return;\n",
       "\n",
       "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
       "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
       "          + ' to learn more about interactive tables.';\n",
       "        element.innerHTML = '';\n",
       "        dataTable['output_type'] = 'display_data';\n",
       "        await google.colab.output.renderOutput(dataTable, element);\n",
       "        const docLink = document.createElement('div');\n",
       "        docLink.innerHTML = docLinkHtml;\n",
       "        element.appendChild(docLink);\n",
       "      }\n",
       "    </script>\n",
       "  </div>\n",
       "\n",
       "\n",
       "<div id=\"df-a4a1223f-77fe-47ea-894d-6cfbbf4f7793\">\n",
       "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-a4a1223f-77fe-47ea-894d-6cfbbf4f7793')\"\n",
       "            title=\"Suggest charts\"\n",
       "            style=\"display:none;\">\n",
       "\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
       "     width=\"24px\">\n",
       "    <g>\n",
       "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
       "    </g>\n",
       "</svg>\n",
       "  </button>\n",
       "\n",
       "<style>\n",
       "  .colab-df-quickchart {\n",
       "      --bg-color: #E8F0FE;\n",
       "      --fill-color: #1967D2;\n",
       "      --hover-bg-color: #E2EBFA;\n",
       "      --hover-fill-color: #174EA6;\n",
       "      --disabled-fill-color: #AAA;\n",
       "      --disabled-bg-color: #DDD;\n",
       "  }\n",
       "\n",
       "  [theme=dark] .colab-df-quickchart {\n",
       "      --bg-color: #3B4455;\n",
       "      --fill-color: #D2E3FC;\n",
       "      --hover-bg-color: #434B5C;\n",
       "      --hover-fill-color: #FFFFFF;\n",
       "      --disabled-bg-color: #3B4455;\n",
       "      --disabled-fill-color: #666;\n",
       "  }\n",
       "\n",
       "  .colab-df-quickchart {\n",
       "    background-color: var(--bg-color);\n",
       "    border: none;\n",
       "    border-radius: 50%;\n",
       "    cursor: pointer;\n",
       "    display: none;\n",
       "    fill: var(--fill-color);\n",
       "    height: 32px;\n",
       "    padding: 0;\n",
       "    width: 32px;\n",
       "  }\n",
       "\n",
       "  .colab-df-quickchart:hover {\n",
       "    background-color: var(--hover-bg-color);\n",
       "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
       "    fill: var(--button-hover-fill-color);\n",
       "  }\n",
       "\n",
       "  .colab-df-quickchart-complete:disabled,\n",
       "  .colab-df-quickchart-complete:disabled:hover {\n",
       "    background-color: var(--disabled-bg-color);\n",
       "    fill: var(--disabled-fill-color);\n",
       "    box-shadow: none;\n",
       "  }\n",
       "\n",
       "  .colab-df-spinner {\n",
       "    border: 2px solid var(--fill-color);\n",
       "    border-color: transparent;\n",
       "    border-bottom-color: var(--fill-color);\n",
       "    animation:\n",
       "      spin 1s steps(1) infinite;\n",
       "  }\n",
       "\n",
       "  @keyframes spin {\n",
       "    0% {\n",
       "      border-color: transparent;\n",
       "      border-bottom-color: var(--fill-color);\n",
       "      border-left-color: var(--fill-color);\n",
       "    }\n",
       "    20% {\n",
       "      border-color: transparent;\n",
       "      border-left-color: var(--fill-color);\n",
       "      border-top-color: var(--fill-color);\n",
       "    }\n",
       "    30% {\n",
       "      border-color: transparent;\n",
       "      border-left-color: var(--fill-color);\n",
       "      border-top-color: var(--fill-color);\n",
       "      border-right-color: var(--fill-color);\n",
       "    }\n",
       "    40% {\n",
       "      border-color: transparent;\n",
       "      border-right-color: var(--fill-color);\n",
       "      border-top-color: var(--fill-color);\n",
       "    }\n",
       "    60% {\n",
       "      border-color: transparent;\n",
       "      border-right-color: var(--fill-color);\n",
       "    }\n",
       "    80% {\n",
       "      border-color: transparent;\n",
       "      border-right-color: var(--fill-color);\n",
       "      border-bottom-color: var(--fill-color);\n",
       "    }\n",
       "    90% {\n",
       "      border-color: transparent;\n",
       "      border-bottom-color: var(--fill-color);\n",
       "    }\n",
       "  }\n",
       "</style>\n",
       "\n",
       "  <script>\n",
       "    async function quickchart(key) {\n",
       "      const quickchartButtonEl =\n",
       "        document.querySelector('#' + key + ' button');\n",
       "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
       "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
       "      try {\n",
       "        const charts = await google.colab.kernel.invokeFunction(\n",
       "            'suggestCharts', [key], {});\n",
       "      } catch (error) {\n",
       "        console.error('Error during call to suggestCharts:', error);\n",
       "      }\n",
       "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
       "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
       "    }\n",
       "    (() => {\n",
       "      let quickchartButtonEl =\n",
       "        document.querySelector('#df-a4a1223f-77fe-47ea-894d-6cfbbf4f7793 button');\n",
       "      quickchartButtonEl.style.display =\n",
       "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
       "    })();\n",
       "  </script>\n",
       "</div>\n",
       "\n",
       "  <div id=\"id_0dc6235b-9540-4b0d-b387-925cc018ee56\">\n",
       "    <style>\n",
       "      .colab-df-generate {\n",
       "        background-color: #E8F0FE;\n",
       "        border: none;\n",
       "        border-radius: 50%;\n",
       "        cursor: pointer;\n",
       "        display: none;\n",
       "        fill: #1967D2;\n",
       "        height: 32px;\n",
       "        padding: 0 0 0 0;\n",
       "        width: 32px;\n",
       "      }\n",
       "\n",
       "      .colab-df-generate:hover {\n",
       "        background-color: #E2EBFA;\n",
       "        box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
       "        fill: #174EA6;\n",
       "      }\n",
       "\n",
       "      [theme=dark] .colab-df-generate {\n",
       "        background-color: #3B4455;\n",
       "        fill: #D2E3FC;\n",
       "      }\n",
       "\n",
       "      [theme=dark] .colab-df-generate:hover {\n",
       "        background-color: #434B5C;\n",
       "        box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
       "        filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
       "        fill: #FFFFFF;\n",
       "      }\n",
       "    </style>\n",
       "    <button class=\"colab-df-generate\" onclick=\"generateWithVariable('df')\"\n",
       "            title=\"Generate code using this dataframe.\"\n",
       "            style=\"display:none;\">\n",
       "\n",
       "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
       "       width=\"24px\">\n",
       "    <path d=\"M7,19H8.4L18.45,9,17,7.55,7,17.6ZM5,21V16.75L18.45,3.32a2,2,0,0,1,2.83,0l1.4,1.43a1.91,1.91,0,0,1,.58,1.4,1.91,1.91,0,0,1-.58,1.4L9.25,21ZM18.45,9,17,7.55Zm-12,3A5.31,5.31,0,0,0,4.9,8.1,5.31,5.31,0,0,0,1,6.5,5.31,5.31,0,0,0,4.9,4.9,5.31,5.31,0,0,0,6.5,1,5.31,5.31,0,0,0,8.1,4.9,5.31,5.31,0,0,0,12,6.5,5.46,5.46,0,0,0,6.5,12Z\"/>\n",
       "  </svg>\n",
       "    </button>\n",
       "    <script>\n",
       "      (() => {\n",
       "      const buttonEl =\n",
       "        document.querySelector('#id_0dc6235b-9540-4b0d-b387-925cc018ee56 button.colab-df-generate');\n",
       "      buttonEl.style.display =\n",
       "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
       "\n",
       "      buttonEl.onclick = () => {\n",
       "        google.colab.notebook.generateWithVariable('df');\n",
       "      }\n",
       "      })();\n",
       "    </script>\n",
       "  </div>\n",
       "\n",
       "    </div>\n",
       "  </div>\n"
      ],
      "application/vnd.google.colaboratory.intrinsic+json": {
       "type": "dataframe",
       "variable_name": "df"
      }
     },
     "metadata": {},
     "execution_count": 6
    }
   ]
  }
 ]
}
